package com.ruoyi.baseInfo.service.Impl;


import com.ruoyi.baseInfo.domain.StoresInfo;
import com.ruoyi.baseInfo.mapper.StoresInfoMapper;
import com.ruoyi.baseInfo.service.StoresInfoService;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;


@Service
public class StoresInfoServiceImpl implements StoresInfoService {
    @Autowired(required = false)
    private StoresInfoMapper storesInfoMapper;
    @Override
    public List<Map<String , Object>> getStoresList(StoresInfo storesInfo) {
        String loginUserId = String.valueOf(SecurityUtils.getUserId());
        String companyId = storesInfoMapper.getCompanyByUserId(loginUserId);
        List result = new ArrayList();
        if(companyId == null){
            return result;
        }
        storesInfo.setCompanyId(companyId);
        return storesInfoMapper.getStoresList(storesInfo);
    }

    @Override
    public int insertStores(StoresInfo storesInfo) {
        return storesInfoMapper.insertStores(storesInfo);
    }

}
